home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / h.z / IO.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-28  |  6.4 KB  |  202 lines

  1. /*
  2.  *  io.h        Low level I/O routines that work with file handles
  3.  *
  4.  *  Copyright by WATCOM International Corp. 1988-1996.  All rights reserved.
  5.  */
  6. #ifndef _IO_H_INCLUDED
  7. #define _IO_H_INCLUDED
  8. #if !defined(_ENABLE_AUTODEPEND)
  9.   #pragma read_only_file;
  10. #endif
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14.  
  15. #ifndef _COMDEF_H_INCLUDED
  16.  #include <_comdef.h>
  17. #endif
  18.  
  19. #if defined(_M_IX86)
  20.   #pragma pack(__push,1);
  21. #else
  22.   #pragma pack(__push,8);
  23. #endif
  24.  
  25. #ifndef _TIME_T_DEFINED
  26. #define _TIME_T_DEFINED
  27. #define _TIME_T_DEFINED_
  28. typedef unsigned long time_t; /* time value */
  29. #endif
  30.  
  31. #ifndef _WCHAR_T_DEFINED
  32. #define _WCHAR_T_DEFINED
  33. #define _WCHAR_T_DEFINED_
  34. #ifdef __cplusplus
  35. typedef long char wchar_t;
  36. #else
  37. typedef unsigned short wchar_t;
  38. #endif
  39. #endif
  40.  
  41. #ifndef _MAX_PATH
  42.  #if defined(__OS2__) || defined(__NT__)
  43.   #define _MAX_PATH   260 /* maximum length of full pathname */
  44.  #else
  45.   #define _MAX_PATH   144 /* maximum length of full pathname */
  46.  #endif
  47. #endif
  48.  
  49. /* Symbolic constants for the access() function */
  50.  
  51. #define R_OK    4       /*  Test for read permission    */
  52. #define W_OK    2       /*  Test for write permission   */
  53. #define X_OK    1       /*  Test for execute permission */
  54. #define F_OK    0       /*  Test for existence of file  */
  55.  
  56. #define ACCESS_WR       0x0002
  57. #define ACCESS_RD       0x0004
  58.  
  59. /* Symbolic constants for the lseek() function */
  60.  
  61. #define SEEK_SET    0           /* Seek relative to the start of file   */
  62. #define SEEK_CUR    1           /* Seek relative to current position    */
  63. #define SEEK_END    2           /* Seek relative to the end of the file */
  64.  
  65. /* Symbolic constants for stream I/O */
  66.  
  67. #define STDIN_FILENO    0
  68. #define STDOUT_FILENO   1
  69. #define STDERR_FILENO   2
  70. #ifndef NO_EXT_KEYS     /* extensions enabled */
  71. #if ! defined(__NT__)
  72. #define STDAUX_FILENO   3
  73. #define STDPRN_FILENO   4
  74. #endif
  75. #endif
  76.  
  77.  
  78. typedef unsigned long    _fsize_t;
  79.  
  80. struct _finddata_t {
  81.     unsigned    attrib;
  82.     time_t    time_create;
  83.     time_t    time_access;
  84.     time_t    time_write;
  85.     _fsize_t    size;
  86.     char    name[_MAX_PATH];
  87. };
  88.  
  89. struct _wfinddata_t {
  90.     unsigned    attrib;
  91.     time_t    time_create;
  92.     time_t    time_access;
  93.     time_t    time_write;
  94.     _fsize_t    size;
  95.     wchar_t    name[_MAX_PATH];
  96. };
  97.  
  98. #ifdef __WATCOM_INT64__
  99. struct _finddatai64_t {
  100.     unsigned    attrib;
  101.     time_t    time_create;
  102.     time_t    time_access;
  103.     time_t    time_write;
  104.     __int64    size;
  105.     char    name[_MAX_PATH];
  106. };
  107.  
  108. struct _wfinddatai64_t {
  109.     unsigned    attrib;
  110.     time_t    time_create;
  111.     time_t    time_access;
  112.     time_t    time_write;
  113.     __int64    size;
  114.     wchar_t    name[_MAX_PATH];
  115. };
  116. #endif
  117.  
  118. /* File attribute constants for attrib field */
  119. #define _A_NORMAL       0x00    /* Normal file - read/write permitted */
  120. #define _A_RDONLY       0x01    /* Read-only file */
  121. #define _A_HIDDEN       0x02    /* Hidden file */
  122. #define _A_SYSTEM       0x04    /* System file */
  123. #define _A_SUBDIR       0x10    /* Subdirectory */
  124. #define _A_ARCH         0x20    /* Archive file */
  125.  
  126.  
  127. _WCRTLINK extern int  access(const char *__path,int __mode);
  128. _WCRTLINK extern int  _access(const char *__path,int __mode);
  129. _WCRTLINK extern int  chmod(const char *__path,int __pmode);
  130. _WCRTLINK extern int  chsize(int __handle,long __size);
  131. _WCRTLINK extern int  close(int __handle);
  132. _WCRTLINK extern int  _close(int __handle);
  133. _WCRTLINK extern int  creat(const char *__path,int __pmode);
  134. _WCRTLINK extern int  dup(int __handle);
  135. _WCRTLINK extern int  _dup(int __handle);
  136. _WCRTLINK extern int  dup2(int __handle1,int __handle2);
  137. _WCRTLINK extern int  eof(int __handle);
  138. _WCRTLINK extern long filelength(int __handle);
  139. _WCRTLINK extern int  fsync( int __filedes );
  140. _WCRTLINK extern long _get_osfhandle( int __posixhandle );
  141. _WCRTLINK extern int  _hdopen(int __handle,int __mode);
  142. _WCRTLINK extern int  isatty(int __handle);
  143. _WCRTLINK extern int  lock(int __handle,unsigned long __offset,
  144.                unsigned long __nbytes);
  145. _WCRTLINK extern long lseek(int __handle,long __offset,int __origin);
  146. _WCRTLINK extern long _lseek(int __handle,long __offset,int __origin);
  147. _WCRTLINK extern int  open(const char *__path,int __oflag,...);
  148. _WCRTLINK extern int  _open(const char *__path,int __oflag,...);
  149. _WCRTLINK extern int  _open_osfhandle( long __osfhandle, int __flags );
  150. _WCRTLINK extern int  _os_handle(int __handle);
  151. _WCRTLINK extern int  _pipe( int *__phandles, unsigned __psize, int __textmode );
  152. _WCRTLINK extern int  read(int __handle,void *__buf,unsigned int __len);
  153. _WCRTLINK extern int  setmode(int __handle,int __mode);
  154. _WCRTLINK extern int  sopen(const char *__path,int __oflag,int __shflag,...);
  155. _WCRTLINK extern long tell(int __handle);
  156. _WCRTLINK extern int  umask(int __permission);
  157. _WCRTLINK extern int  unlink(const char *__path);
  158. _WCRTLINK extern int  unlock(int __handle,unsigned long __offset,
  159.                  unsigned long __nbytes);
  160. _WCRTLINK extern int  write(int __handle,const void *__buf,unsigned int __len);
  161. _WCRTLINK extern int  _waccess(const wchar_t *__path,int __mode);
  162. _WCRTLINK extern int  _wchmod( const wchar_t *__path, int __pmode );
  163. _WCRTLINK extern int  _wunlink(const wchar_t *__path);
  164.  
  165. _WCRTLINK extern long _findfirst( const char *__filespec,
  166.                   struct _finddata_t *__fileinfo );
  167. _WCRTLINK extern long _wfindfirst( const wchar_t *__filespec,
  168.                    struct _wfinddata_t *__fileinfo );
  169. _WCRTLINK extern int  _findnext( long __handle,
  170.                  struct _finddata_t *__fileinfo );
  171. _WCRTLINK extern int  _wfindnext( long __handle,
  172.                   struct _wfinddata_t *__fileinfo );
  173. _WCRTLINK extern int  _findclose( long __handle );
  174.  
  175. _WCRTLINK extern char *        _mktemp( char *__template );
  176. _WCRTLINK extern wchar_t *  _wmktemp( wchar_t *__template );
  177.  
  178. #ifdef __WATCOM_INT64__
  179. _WCRTLINK extern long        _findfirsti64( const char *__filespec,
  180.                        struct _finddatai64_t *__fileinfo );
  181. _WCRTLINK extern long        _wfindfirsti64( const wchar_t *__filespec,
  182.                         struct _wfinddatai64_t *__fileinfo );
  183. _WCRTLINK extern int        _findnexti64( long __handle,
  184.                       struct _finddatai64_t *__fileinfo );
  185. _WCRTLINK extern int        _wfindnexti64( long __handle,
  186.                        struct _wfinddatai64_t *__fileinfo );
  187. _WCRTLINK extern __int64    _filelengthi64( int __handle );
  188. _WCRTLINK extern __int64    _lseeki64( int __handle, __int64 __offset,
  189.                        int __origin );
  190. _WCRTLINK extern __int64    _telli64( int __handle );
  191. #endif
  192.  
  193. #ifndef _STAT_H_INCLUDED
  194.  #include <sys/stat.h>
  195. #endif
  196.  
  197. #pragma pack(__pop);
  198. #ifdef __cplusplus
  199. };
  200. #endif
  201. #endif
  202.